﻿$(window).load(function () {
    var size = 350;

    $("img.user-image").each(function (i) {
        var img = $(this);
        if (img.height() > size || img.width() > size) {
            if (img.height() > img.width()) {
                var h = size;
                var w = Math.ceil(img.width() / img.height() * size);
                img.css({ height: h, width: w });
            }
            else {
                var w = size;
                var h = Math.ceil(img.height() / img.width() * size);
                img.css({ height: h, width: w });
            }
        }
    });
});